﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
checkadmin(4)
Dim act,templatedir
act=trim(request.Form("act"))
templatedir=trim(request.Form("templatedir"))
response.write(act)
response.write(templatedir)

If act="adddir" Then 
	If templatedir<>"" Then 
		templatedir=Replace(templatedir,"/","")
		Call CreateFolders(GetPath("template/"&templatedir))
		Call CreateFolders(GetPath("template/"&templatedir&"/images"))
		Call CreateFolders(GetPath("template/"&templatedir&"/js"))
		Call SaveFile(GetPath("template/"&templatedir&"/articlelist.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/articleshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/commentshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/default.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/footer.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/friendlink.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/guestbooklist.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/guestbookshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/header.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/joblist.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/jobshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/photolist.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/photoshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/productlist.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/productshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/sitemap.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/speciallist.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/specialshow.html"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/style.css"),"")
		Call SaveFile(GetPath("template/"&templatedir&"/typeshow.html"),"")
		response.redirect("manage_template.asp")
	Else
		historygoback("请填写目录名")
	End If 
End If 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新建目录</title>
<link type="text/css" href="style/style.css" rel="stylesheet" rev="stylesheet"/>
<script type="text/javascript" src="admin_js/common.js"></script> 
</head>
<body>
<%
dim appPath,rootuploadpath
appPath=replace(LCase(Request.ServerVariables("PATH_INFO")), "admin/manage_template_dir.asp","" )
rootuploadpath = appPath&"template"
dim fso,objFolder,objSubFolders,objSubFolder,allfolders
set fso=server.CreateObject("scripting.filesystemobject")
on error resume next
set objFolder=fso.GetFolder(Server.Mappath(rootuploadpath))
set objSubFolders=objFolder.Subfolders
for each objSubFolder in objSubFolders 
allfolders=allfolders&"|" + objSubFolder.name
next
set objFolder=nothing
set objSubFolders=nothing
set fso=nothing
%>
<script type="text/javascript">
<!--
	function checkdirform(){
		var flag=true;
		flag=isNotEmpty("templatedir","文件目录名");
		var allfolders=document.getElementById("allfolders").value;
		var templatedir=document.getElementById("templatedir").value;
		if(allfolders!=""){
			allfolders=allfolders+"|";
			if(allfolders.indexOf("|"+templatedir+"|")!=-1){
				alert("已经存在同名称的模板");
				document.getElementById("templatedir").focus();
				flag=false;
			}
		}
		return flag;
	}
//-->
</script>
<form method="post" id="rzform" name="rzform" action="manage_template_dir.asp" onsubmit="return checkdirform();">
<table class="table_500" cellspacing="0" cellpadding="0">
<input type="hidden" id="allfolders" name="allfolders" value="<%=allfolders%>"/>
<input type="hidden" name="act" id="act" value="adddir"/>
<tr>
	<th colspan="2">新建模板存放目录</th>
</tr>
<tr  class="row">
<td colspan="2" class="tdcenter">
请输入文件目录名：<input type="text" id="templatedir" name="templatedir" value="" />&nbsp;如mydir，不要带“/”
</td>
</tr>
<tr  class="row">
	<td class="tdcenter" colspan="2"><input type="submit" class="btn"  value="<%out("lang_save")%>" />&nbsp;&nbsp;<input type="button" class="btn"  value="<%out("lang_back")%>" onclick="javascript:location.href='manage_template.asp'"/></td>
</tr>
</table>
</form>
</body>
</html>
